package com.yunfei.core.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

/*
 * 文件读写
 */
public class FileOperater {

	
	/*
	 * 给定文件路径
	 * 返回文件中的n行字符串（List）格式
	 */
	public static ArrayList<String> readLine(String fileName) {
		ArrayList<String> strList = new ArrayList<String>();
		File file = new File(fileName);
		BufferedReader reader = null;
		try {
			reader = new BufferedReader(new FileReader(file));
			String tempString = null;
			int line = 0;
			while((tempString = reader.readLine())!=null)
			{
				strList.add(tempString);
				line++;
			}
			reader.close();		
			return strList;
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	
	
}

